#!/usr/bin/env python3
# -*- coding: utf-8 -*
# Time :2024-06-15 10:44
# @Author: baiping
from quote.base.browseroperation import BrowserOperation
from quote.base.usebrowser import UseBrowser


class LoginPage(BrowserOperation):

    # def __init__(self):
    #     self.ub = UseBrowser()
    #     self.bo = BrowserOperation(UseBrowser.driver)

    # 登录功能
    def login(self,username='',password=''):
        self.open_url("http://172.16.114.98:8080/JavaPrj_6/")
        self.input_text('name', 'username', username)
        self.input_text('name', 'password', password)
        self.click_element('name', 'submit')

    #获取成功登录提示信息
    def get_suc_info(self):
        self.change_frame('main')
        suc_info=self.get_text('xpath','/html/body/table/tbody/tr[1]/td/span')
        return suc_info

    #获取失败的信息
    def get_fail_info(self):
        fail_info = self.get_text('xpath', '/html/body/table/tbody/tr[1]/td[2]/form/table/tbody/tr[5]/td')
        return fail_info
